home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / System / Sample 2.4 Think C distribution / hlp.c < prev    next >
Text File  |  1991-02-25  |  19KB  |  686 lines

  1. /*______________________________________________________________________
  2.  
  3.     hlp.c - Help Module.
  4.     
  5.     Copyright © 1988, 1989, 1990 Northwestern University.  Permission is 
  6.     granted to use this code in your own projects, provided you give credit 
  7.     to both John Norstad and Northwestern University in your about box or 
  8.     document.
  9.     
  10.     This reusable module implements help windows.  The help window contains
  11.     a scrolling field containing the text and an optional table of contents.
  12.     
  13.     The caller supplies several resources - a WIND resource for the window,
  14.     a sequence of STR# resources containing the text, and a TCON resource 
  15.     for the table of contents.
  16.     
  17.     The sequence of STR# resources must be terminated by an empty STR#
  18.     resource (an STR# resource of size 2 containing 0 strings).
  19.     
  20.     There is a limit of 8k lines of text in the help window
  21. _____________________________________________________________________*/
  22.  
  23.  
  24. #include "rep.h"
  25. #include "rpp.h"
  26. #include "utl.h"
  27. #include "hlp.h"
  28. #include "doc.h"
  29.  
  30.  
  31. /*______________________________________________________________________
  32.  
  33.     Global Constants and Variables.
  34. _____________________________________________________________________*/
  35.  
  36. static    hlp_PBlock         P;                        /* param block */
  37. static    WindowPtr        HelpWindow;            /* pointer to window record */
  38. static    Handle            Report;                /* handle to report */
  39. static    Handle            TabConRez;            /* handle to TCON resource */
  40.  
  41. static    short                TopLine;        /* line number of top line in table
  42.                                                     of contents rectangle */
  43. static    short                BotLine;        /* line number of bottom line in table
  44.                                                     of contents rectangle */
  45. static    short                LastLine;    /* line number of last line in table
  46.                                                     of contents */
  47. static    short                LastCell;    /* cell number of last cell in table
  48.                                                     of contents rectangle */
  49.                                                     
  50. static    Rect                Cell1Rect;    /* top cell rectangle */
  51. static    Rect                Cell2Rect;    /* second cell rectangle */
  52. static    Rect                CellARect;    /* second to bottom cell rectangle */
  53. static    Rect                CellBRect;    /* bottom cell rectangle */
  54.  
  55. static    Rect                TCScrollRect;    /* table of contents scrolling
  56.                                                         rectangle */
  57.                                                     
  58. static    RgnHandle        UpdateRgn;    /* update region for ScrollRect calls */                                                    
  59.                                                 
  60. static     PolyHandle        TopTri;        /* top table of contents scrolling 
  61.                                                     triangle */
  62. static    PolyHandle        BotTri;        /* bottom table of contents scrolling
  63.                                                     triangle */
  64.  
  65. /*______________________________________________________________________
  66.  
  67.     DelayScroll - Slow Down Scrolling.
  68.     
  69.     Entry:    n = delay factor (smaller value = longer delay).
  70. _____________________________________________________________________*/
  71.  
  72.  
  73. static void DelayScroll (short n)
  74.  
  75. {
  76.     long            waitTill;
  77.  
  78.     if (n >= 32) return;
  79.     waitTill = TickCount() + 8 - (n>>2);
  80.     while (TickCount() < waitTill) {
  81.         if (!StillDown()) break;
  82.     };
  83. }
  84.  
  85. /*______________________________________________________________________
  86.  
  87.     GetLine - Get Table of Contents Line.
  88.     
  89.     Entry:    n = line number.
  90.                 
  91.     Exit:        function result = pointer to line.
  92. _____________________________________________________________________*/
  93.  
  94.  
  95. static char *GetLine (short n)
  96.  
  97. {
  98.     char        *q;
  99.     
  100.     q = *TabConRez + 4;
  101.     while (true) {
  102.         if (*q & docScreen) {
  103.             if (n) {
  104.                 n--;
  105.             } else {
  106.                 return q+1;
  107.             };
  108.         };
  109.         q += *(q+1) + 4;
  110.         if ((long)q & 1) q++;
  111.     };
  112. }
  113.  
  114. /*______________________________________________________________________
  115.  
  116.     DoTcon - Check for and Process Mouse Down in Table of Contents.
  117.     
  118.     Entry:    where = location of mouse down event, in local coords.
  119. _____________________________________________________________________*/
  120.  
  121.  
  122. static void DoTcon (Point where)
  123.  
  124. {
  125.     Point                curLoc;                /* current mouse loc */
  126.     short                oldCell;                /* old cell pos, or -1 if none. */
  127.     short                newCell;                /* new cell pos, or -1 if none */
  128.     char                *p;                    /* pointer into TCON resource */
  129.     Rect                frameRect;            /* rect enclosing table of contents */
  130.     Rect                invertRect;            /* rect to be inverted */
  131.     long                startTicks;            /* tick count at mouse down */
  132.                                 
  133.     /* Return if mouse loc is not in the table of contents rectangle. */
  134.                                                     
  135.     curLoc = where;
  136.     frameRect = P.tabConRect;
  137.     InsetRect(&frameRect, 1, 1);
  138.     if (!PtInRect(curLoc, &frameRect)) return;
  139.     
  140.     /* Track the mouse and hilite the table of contents lines. */
  141.     
  142.     oldCell = -1;
  143.     invertRect = frameRect;
  144.     startTicks = TickCount();
  145.     while (true) {
  146.         if (PtInRect(curLoc, &frameRect)) {
  147.             newCell = (curLoc.v - frameRect.top - 1) / P.tabConLSep;
  148.         } else if (curLoc.h >= frameRect.left && curLoc.h <= frameRect.right) {
  149.             if (TopLine && curLoc.v <= frameRect.top) {
  150.                 newCell = 0;
  151.             } else if (BotLine < LastLine && curLoc.v >= frameRect.bottom) {
  152.                 newCell = LastCell;
  153.             } else {
  154.                 newCell = -1;
  155.             };
  156.         } else { 
  157.             newCell = -1;
  158.         };
  159.         if (newCell != oldCell) {
  160.             if (oldCell >= 0) {
  161.                 invertRect.top = frameRect.top + P.tabConLSep*oldCell;
  162.                 invertRect.bottom = invertRect.top + P.tabConLSep;
  163.                 InvertRect(&invertRect);
  164.             };
  165.             if (newCell >= 0) {
  166.                 if (!newCell && TopLine) {
  167.                     /* scroll down 1 line */
  168.                     ScrollRect(&TCScrollRect, 0, P.tabConLSep, UpdateRgn);
  169.                     SetOrigin(0, 0);
  170.                     p = GetLine(TopLine);
  171.                     TextBox(p+1, *p, &Cell2Rect, teJustLeft);
  172.                     TopLine--;
  173.                     if (!TopLine) {
  174.                         EraseRect(&Cell1Rect);
  175.                         p = GetLine(0);
  176.                         TextBox(p+1, *p, &Cell1Rect, teJustLeft);
  177.                     };
  178.                     if (BotLine == LastLine) {
  179.                         EraseRect(&CellBRect);
  180.                         PaintPoly(BotTri);
  181.                     };
  182.                     BotLine--;
  183.                     newCell = -1;
  184.                     if (TopLine) {
  185.                         GetMouse(&curLoc);
  186.                         DelayScroll(Cell2Rect.top - curLoc.v);
  187.                     };
  188.                 } else if (newCell == LastCell && BotLine < LastLine) {
  189.                     /* scroll up 1 line */
  190.                     ScrollRect(&TCScrollRect, 0, -P.tabConLSep, UpdateRgn);
  191.                     SetOrigin(0, 0);
  192.                     p = GetLine(BotLine);
  193.                     TextBox(p+1, *p, &CellARect, teJustLeft);
  194.                     BotLine++;
  195.                     if (BotLine == LastLine) {
  196.                         EraseRect(&CellBRect);
  197.                         p = GetLine(LastLine);
  198.                         TextBox(p+1, *p, &CellBRect, teJustLeft);
  199.                     };
  200.                     if (!TopLine) {
  201.                         EraseRect(&Cell1Rect);
  202.                         PaintPoly(TopTri);
  203.                     };
  204.                     TopLine++;
  205.                     newCell = -1;
  206.                     if (BotLine < LastLine) {
  207.                         GetMouse(&curLoc);
  208.                         DelayScroll(curLoc.v - CellARect.bottom);
  209.                     };
  210.                 } else {
  211.                     invertRect.top = frameRect.top + P.tabConLSep*newCell;
  212.                     invertRect.bottom = invertRect.top + P.tabConLSep;
  213.                     InvertRect(&invertRect);
  214.                 };
  215.             };
  216.             oldCell = newCell;
  217.         };
  218.         if (!StillDown()) break;
  219.         GetMouse(&curLoc);
  220.     };
  221.     
  222.     /* Jump to the selected section. */
  223.     
  224.     if ((newCell >= 0) && 
  225.         (newCell || !TopLine) && 
  226.         (newCell < LastCell || BotLine == LastLine)) {
  227.         while (TickCount() < startTicks+8);
  228.         invertRect.top = frameRect.top + P.tabConLSep*newCell;
  229.         invertRect.bottom = invertRect.top + P.tabConLSep;
  230.         InvertRect(&invertRect);
  231.         p = GetLine(newCell + TopLine) - 3;
  232.         rep_Jump(Report, *((short*)p), true);
  233.     };
  234. }
  235.  
  236. /*______________________________________________________________________
  237.  
  238.     DrawTcon - Draw the Table of Contents.
  239. _____________________________________________________________________*/
  240.  
  241.  
  242. static void DrawTcon (void)
  243.  
  244. {
  245.     Rect                theBox;                /* rectangle enclosing cur line */
  246.     char                *q;                    /* pointer into TCON resource */
  247.     short                oldFont;                /* saved font number */
  248.     short                oldSize;                /* saved font size */
  249.     Rect                frameBox;            /* box for framing */
  250.     short                i;                        /* cell index */
  251.     
  252.     theBox = Cell1Rect;
  253.     oldFont = thePort->txFont;
  254.     oldSize = thePort->txSize;
  255.     TextFont(P.tabConFNum);
  256.     TextSize(P.tabConFSize);
  257.     for (i = 0; i <= LastCell; i++) {
  258.         if (!i && TopLine) {
  259.             PaintPoly(TopTri);
  260.         } else if (i == LastCell && BotLine < LastLine) {
  261.             PaintPoly(BotTri);
  262.         } else {
  263.             q = GetLine(TopLine+i);
  264.             TextBox(q+1, *q, &theBox, teJustLeft);
  265.         };
  266.         OffsetRect(&theBox, 0, P.tabConLSep);
  267.     };
  268.     TextFont(oldFont);
  269.     TextSize(oldSize);
  270.     frameBox = P.tabConRect;
  271.     FrameRect(&frameBox);
  272.     MoveTo(frameBox.right, frameBox.top+2);
  273.     LineTo(frameBox.right, frameBox.bottom);
  274.     LineTo(frameBox.left+2, frameBox.bottom);
  275. }
  276.  
  277. /*______________________________________________________________________
  278.  
  279.     hlp_Open - Open Help Window.
  280.     
  281.     Entry:    theWindow = pointer to opened window, positioned and sized,
  282.                     invisible.
  283.                     
  284.                 p = pointer to parameter block, with fields set as follows:
  285.     
  286.                 firstStrID = resource id of first STR# resource.
  287.                 listDefID = resource id of type 1 report LDEF.
  288.                 textRect = rectangle enclosing the text and its scroll bar.
  289.                 fontNum = font number for text.
  290.                 fontSize = font size for text.
  291.                 tabConID = resource id of TCON resource.
  292.                 tabConRect = rectangle for table of contents.
  293.                 tabConFNum = table of contents font number.
  294.                 tabConFSize = table of contents font size.
  295.                 tabConLSep = table of contents line separation, in pixels.
  296.                 tag = tag of line to jump to initially, or 0 if none.  Takes
  297.                     precedence over scrollLine.
  298.                 tagRezID = resource id of TAG resource.
  299.                 scrollLine = line number of line to jump to initially.
  300.                 cellRezID = resource id of CELL resource.
  301.                 cellOption = CELL resource disposal option:
  302.                     0 = release the CELL resource.
  303.                     1 = keep the CELL resource, and leave it purgable.
  304.                     2 = keep the CELL resource, and leave it unpurgable.
  305.                 extraUpdate = pointer to a funtion to be called during
  306.                     update event processing, or nil if none.  This function 
  307.                     can draw any extra decorative stuff in the help window 
  308.                     (e.g., a "Table of Contents" title above the table of 
  309.                     contents).
  310.                     
  311.     Exit:        window initialized and shown.
  312.     
  313.     For best results, the textRect rectangle height should 2 more than an 
  314.     even multiple of the window font's ascent plus descent plus leading
  315.     (12 for Geneva 9).  This will make an even number of rows appear in 
  316.     the rectangle, which makes scrolling look nice.
  317.         
  318.     Similarly, the tabConRect rectangle height should be 2 more than an 
  319.     even multiple of tabConLSep.  If this rectangle is not tall enough to 
  320.     contain all of the table of contents lines, then the menu will scroll.
  321.  
  322.     The tabConRect rectangle should not be taller than the total number
  323.     of table of contents entries.  That is, you should gaurantee that
  324.     
  325.         (tabConRect.bottom - tabConRect.top - 2) / tabConLSep <=
  326.             total number of table of contents entries.
  327. _____________________________________________________________________*/
  328.  
  329.  
  330. void hlp_Open (WindowPtr theWindow, hlp_PBlock *p)
  331.     
  332. {
  333.     short                h, v;                    /* h and v coords for triangles */
  334.     short                tsize;                /* size (height) of triangles */
  335.     unsigned char    *q;                    /* ptr into TCON resource */
  336.     short                n;                        /* loop index */
  337.     
  338.     P = *p;
  339.     HelpWindow = theWindow;
  340.     SetPort(HelpWindow);
  341.  
  342.     /* Initialize table of contents. */
  343.     
  344.     /* Create the top and bottom table of contents scrolling triangles. */
  345.  
  346.     h = p->tabConRect.left + 5;
  347.     v = p->tabConRect.top + p->tabConLSep + 1 - 
  348.         ((p->tabConLSep-p->tabConFSize)>>1);
  349.     tsize = p->tabConFSize-2;
  350.     TopTri = OpenPoly();
  351.     MoveTo(h,v);
  352.     Line(tsize<<1, 0);
  353.     Line(-tsize, -tsize);
  354.     LineTo(h, v);
  355.     ClosePoly();
  356.     v = p->tabConRect.bottom - p->tabConLSep - 1 + 
  357.         ((p->tabConLSep-p->tabConFSize)>>1);
  358.     BotTri = OpenPoly();
  359.     MoveTo(h,v);
  360.     Line(tsize<<1, 0);
  361.     Line(-tsize, tsize);
  362.     LineTo(h, v);
  363.     ClosePoly();
  364.  
  365.     /* Load and lock the TCON resource. */
  366.  
  367.     TabConRez = GetResource('TCON', p->tabConID);
  368.     MoveHHi(TabConRez);
  369.     HLock(TabConRez);
  370.     
  371.     /* Initialize global variables. */
  372.     
  373.     TopLine = 0;
  374.     q = (unsigned char *)(*TabConRez + 4);
  375.     LastLine = -1;
  376.     for (n = 0; n < **(short**)TabConRez; n++) {
  377.         if (*q & docScreen) LastLine++;
  378.         q += *(q+1) + 4;
  379.         if ((long)q & 1) q++;
  380.     };
  381.     LastCell = (p->tabConRect.bottom - p->tabConRect.top - 2) /
  382.         p->tabConLSep - 1;
  383.     BotLine = LastCell;
  384.     UpdateRgn = NewRgn();
  385.     Cell1Rect = p->tabConRect;
  386.     InsetRect(&Cell1Rect, 4, 1);
  387.     CellBRect = TCScrollRect = Cell1Rect;
  388.     Cell1Rect.bottom = Cell1Rect.top + p->tabConLSep;
  389.     Cell2Rect = Cell1Rect;
  390.     OffsetRect(&Cell2Rect, 0, p->tabConLSep);
  391.     CellBRect.top = CellBRect.bottom - p->tabConLSep;
  392.     CellARect = CellBRect;
  393.     OffsetRect(&CellARect, 0, -p->tabConLSep);
  394.     TCScrollRect.top += p->tabConLSep;
  395.     TCScrollRect.bottom -= p->tabConLSep;
  396.     
  397.     /* Set the window's font id and size. */
  398.     
  399.     TextFont(p->fontNum);
  400.     TextSize(p->fontSize);
  401.     
  402.     /* Initialize the report. */
  403.     
  404.     rep_Init(&p->textRect, HelpWindow, 1, p->firstStrID, p->listDefID, 
  405.         p->cellRezID, &Report);
  406.     if (p->tag) {
  407.         rep_Jump(Report, rep_Tag(p->tagRezID, p->tag), false);
  408.     } else if (p->scrollLine) {
  409.         rep_Jump(Report, p->scrollLine, false);
  410.     };
  411.     
  412.     /* Size the window. */
  413.     
  414.     hlp_Zoom();
  415.     
  416.     /* Show the window. */
  417.     
  418.     utl_LockControls(HelpWindow);
  419.     ShowWindow(HelpWindow);
  420. }
  421.  
  422. /*______________________________________________________________________
  423.  
  424.     hlp_Close - Close Help Window.
  425.     
  426.     Exit:            auxiliary data structures deallocated.
  427.     
  428.     It is the callers responsibility to actually dispose of the window
  429.     proper.
  430. _____________________________________________________________________*/
  431.  
  432.  
  433. void hlp_Close (void)
  434.  
  435. {
  436.     SetPort(HelpWindow);
  437.     HUnlock(TabConRez);
  438.     KillPoly(TopTri);
  439.     KillPoly(BotTri);
  440.     DisposeRgn(UpdateRgn);
  441.     rep_Dispose(Report, P.cellOption);
  442. }
  443.  
  444. /*______________________________________________________________________
  445.  
  446.     hlp_Click - Process Mouse Down Event.
  447.     
  448.     Entry:        where = mouse down location, local coords.
  449. _____________________________________________________________________*/
  450.  
  451.  
  452. void hlp_Click (Point where)
  453.  
  454. {
  455.     Rect                repRect;            /* report rectangle */
  456.  
  457.     rep_GetRect(Report, &repRect);
  458.     if (PtInRect(where, &repRect)) {
  459.         rep_Scroll(Report, where);
  460.     } else {
  461.         DoTcon(where);
  462.     };
  463. }
  464.  
  465. /*______________________________________________________________________
  466.  
  467.     hlp_Activate - Process Activate Event.
  468. _____________________________________________________________________*/
  469.  
  470.  
  471. void hlp_Activate (void)
  472.  
  473. {
  474.     rep_Activate(Report, true);
  475.     utl_DrawGrowIcon(HelpWindow);
  476. }
  477.  
  478. /*______________________________________________________________________
  479.  
  480.     hlp_Deactivate - Process Deactivate Event.
  481. _____________________________________________________________________*/
  482.  
  483.  
  484. void hlp_Deactivate (void)
  485.  
  486. {
  487.     rep_Activate(Report, false);
  488.     utl_DrawGrowIcon(HelpWindow);
  489. }
  490.  
  491. /*______________________________________________________________________
  492.  
  493.     hlp_Update - Process Update Event.
  494.     
  495.     It is the caller's responsibility to set the port to the help window,
  496.     call BeginUpdate, and erase the portrect before calling this routine,
  497.     and to call EndUpdate after calling it.
  498. _____________________________________________________________________*/
  499.  
  500.  
  501. void hlp_Update (void)
  502.  
  503. {
  504.     DrawTcon();
  505.     rep_Update(Report);
  506.     utl_DrawGrowIcon(HelpWindow);
  507.     if (P.extraUpdate) (*P.extraUpdate)();
  508. }
  509.  
  510. /*______________________________________________________________________
  511.  
  512.     hlp_Key - Process Key Event.
  513.     
  514.     Entry:        key = ascii code of key pressed.
  515.                     modifiers = key modifiers.
  516. _____________________________________________________________________*/
  517.  
  518.  
  519. void hlp_Key (short key, short modifiers)
  520.  
  521. {
  522.     
  523.     if (key == upArrow || key == downArrow) {
  524.         (void) rep_Key(Report, key, modifiers);
  525.     };
  526. }
  527.  
  528. /*______________________________________________________________________
  529.  
  530.     hlp_Jump - Jump to a Tag.
  531.     
  532.     Entry:        tag = tag to jump to.
  533. _____________________________________________________________________*/
  534.  
  535.  
  536. void hlp_Jump (short tag)
  537.  
  538. {
  539.     rep_Jump(Report, rep_Tag(P.tagRezID, tag), true);
  540. }
  541.  
  542. /*______________________________________________________________________
  543.  
  544.     hlp_Print - Print Help Text.
  545.     
  546.     Entry:        p = pointer to print parameter block.
  547.                     printOne = true to bypass print job dialog.
  548.                     
  549.     Exit:            function result = error code.
  550. _____________________________________________________________________*/
  551.     
  552.     
  553. OSErr hlp_Print (rpp_PrtBlock *p, Boolean printOne)
  554.  
  555. {
  556.     return rpp_Print(Report, printOne, p);
  557. }
  558.  
  559. /*______________________________________________________________________
  560.  
  561.     ChangeSize - Process Window Size Change.
  562.     
  563.     Entry:    height = new window height.
  564. _____________________________________________________________________*/
  565.  
  566.  
  567. static void ChangeSize (short height)
  568.  
  569. {
  570.     short            newTabConHeight;            /* new tcon rect height */
  571.     short            newLastCell;                /* new cell num of last cell */
  572.     short            deltaCell;                    /* change in number of cells */
  573.     short            deltaHeight;                /* change in height of tcon rect */
  574.     Rect            inval;                        /* rect to be invalidated */
  575.     
  576.     /* Change report size. */
  577.     
  578.     rep_Height(Report, height - 6);
  579.     
  580.     /* Change table of contents size. */
  581.     
  582.     newTabConHeight = height - 20 - P.tabConRect.top;
  583.     newTabConHeight -= (newTabConHeight - 2) % P.tabConLSep;
  584.     newLastCell = (newTabConHeight - 2) / P.tabConLSep - 1;
  585.     if (newLastCell > LastLine) newLastCell = LastLine;
  586.     deltaCell = newLastCell - LastCell;
  587.     deltaHeight = deltaCell * P.tabConLSep;
  588.     P.tabConRect.bottom += deltaHeight;
  589.     LastCell = newLastCell;
  590.     BotLine += deltaCell;
  591.     if (BotLine > LastLine) {
  592.         TopLine -= BotLine-LastLine;
  593.         BotLine = LastLine;
  594.     };
  595.     OffsetRect(&CellARect, 0, deltaHeight);
  596.     OffsetRect(&CellBRect, 0, deltaHeight);
  597.     TCScrollRect.bottom += deltaHeight;
  598.     OffsetPoly(BotTri, 0, deltaHeight);
  599.     inval = P.tabConRect;
  600.     inval.right += 1;
  601.     inval.bottom = HelpWindow->portRect.bottom;
  602.     InvalRect(&inval);
  603. }
  604.  
  605. /*______________________________________________________________________
  606.  
  607.     hlp_Grow - Process Window Grow Operation.
  608.     
  609.     Entry:    height = new window height.
  610.                 width = new window width.
  611. _____________________________________________________________________*/
  612.  
  613.  
  614. void hlp_Grow (short height, short width)
  615.  
  616. {
  617.     utl_InvalGrow(HelpWindow);
  618.     SizeWindow(HelpWindow, width, height, true);
  619.     utl_InvalGrow(HelpWindow);
  620.     ChangeSize(height);
  621. }
  622.     
  623. /*______________________________________________________________________
  624.  
  625.     hlp_Zoom - Process Window Zoom Operation.
  626. _____________________________________________________________________*/
  627.  
  628.  
  629. void hlp_Zoom (void)
  630.  
  631. {
  632.     ChangeSize(HelpWindow->portRect.bottom - HelpWindow->portRect.top);
  633. }
  634.  
  635. /*______________________________________________________________________
  636.  
  637.     hlp_Save - Save Help Document.
  638.     
  639.     Entry:        prompt = prompt string for standard file dialog.
  640.                     defName = default file name for standard file dialog.
  641.                     creator = creator type for saved text file.
  642.                     menuPick = true if save operation was initiated via a 
  643.                         menu pick, false if it was initiated via a command key.
  644.                         
  645.     Exit:            function result = os error code.
  646. _____________________________________________________________________*/
  647.     
  648.     
  649. OSErr hlp_Save (Str255 *prompt, Str255 *defName, OSType creator, 
  650.     Boolean menuPick)
  651.  
  652. {
  653.     Boolean            good;            /* true if file saved */
  654.     
  655.     return rep_Save (Report, prompt, defName, creator, &good, menuPick);
  656. }
  657.  
  658. /*______________________________________________________________________
  659.  
  660.     hlp_GetScrollPos - Get Help Window Scrolling Position.
  661.     
  662.     Exit:            function result = window scrolling position (line number
  663.                         at top of window).
  664. _____________________________________________________________________*/
  665.  
  666.  
  667. short hlp_GetScrollPos (void)
  668.  
  669. {
  670.     return rep_GetPos(Report);
  671. }
  672.  
  673. /*______________________________________________________________________
  674.  
  675.     hlp_GetTconRect - Get Help Window Table of Contents Rectangle.
  676.     
  677.     Exit:        tconRect = tcon rectangle.
  678. _____________________________________________________________________*/
  679.  
  680.  
  681. void hlp_GetTconRect (Rect *tconRect)
  682.  
  683. {
  684.     *tconRect = P.tabConRect;
  685. }
  686.